solving a system of equations